package cn.itrip.auth.service;

import cn.itrip.beans.pojo.ItripUser;

public interface TokenService {
    /**
     * 生成Token
     * @param userAgent
     * @param user
     * @return
     * @throws Exception
     */
    public String  geterateToken(String userAgent, ItripUser user)throws  Exception;

    /**
     * 保存token信息
     * @param token
     * @param user
     * @throws Exception
     */
    public void save(String token, ItripUser user)throws Exception;

    /**
     * 验证token
     * @param userAgent
     * @param token
     * @return
     * @throws Exception
     */
    public boolean validate(String userAgent, String token)throws Exception;

    /**
     * 删除token
     * @param token
     * @throws Exception
     */
    public void delete(String token)throws Exception;

    /**
     * token置换
     * @param userAgent
     * @param token
     * @throws Exception
     */
    public String reloadToken(String userAgent, String token)throws Exception;
}
